﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class MainSite : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserLogIn"] == null)
        {
            LoginLink.Text = "Log In";
        }
        else LoginLink.Text = "Log Out";
    }

    protected void Page_Init(object sender, EventArgs e)
    {
        HtmlLink link = new HtmlLink();

        link.Href = "~/MainSite.css";
        link.Attributes.Add("rel", "stylesheet");
        link.Attributes.Add("type", "text/css");
        Page.Header.Controls.Add(link);
    }


    protected void LoginLink_Click(object sender, EventArgs e)
    {
        if (LoginLink.Text == "Log In")
            Response.Redirect("Login.aspx");
        else
        {
            Session["UserLogIn"] = null;
            Session["orderitems"] = null;
            Session["mytotal"] = null;
            Session["customerid"] = null;
            Response.Redirect("Default.aspx");
        }
    }

    public string OrderLabel
    {
        get { return CurrentOrder.Text; }
        set { CurrentOrder.Text = value; }
    }

    public string TotalLabel
    {
        get { return MyOrderTotal.Text; }
        set { MyOrderTotal.Text = value; }
    }
}
